
#include <inttypes.h>
#include <stdbool.h>
#include "jlink.h"
#include "lib.h"
#include "hexdump.h"
bool jlinkCommandResetTarget(void* dataBuffer,uint32_t * transferred)
{
      uint8_t commandBuffer[1] = {EMU_CMD_RESET_TARGET};
      uint16_t leftLength = 0;
      return jlinkSendCommand(    commandBuffer, sizeof(commandBuffer), &leftLength, sizeof(leftLength),transferred);

}

int main()
{
   uint8_t buffer[1024];
   uint32_t length=sizeof(buffer);
   int r = setup();
   if(r<0)
   {
       goto out;
   }
   
   if(jlinkCommandResetTarget(buffer,&length))
   {
           if(length>0) hexdump(buffer,length,16);
   }
   else
   {
          perror("usb");
   }
out:
   cleanup();

}

